package com.boot.mgt.service.impl


import com.boot.core.result.ResultTo
import com.boot.mgt.dao.mysql.TaAccidentImageMapper


import com.boot.mgt.dao.mysql.AccidentFileMapper
import com.boot.mgt.dao.mysql.CurrentRowMapper
import com.boot.mgt.dao.mysql.TaAccidentMapper
import com.boot.mgt.model.TaAccidentImage

import com.boot.mgt.model.AccidentFile
import com.boot.mgt.model.CurrentRow
import com.boot.mgt.model.TaAccident

import com.boot.mgt.service.AccidentFileService
import com.boot.mgt.service.CurrentRowService
import com.github.pagehelper.PageHelper
import com.github.pagehelper.PageInfo
import com.googlecode.jsonrpc4j.spring.AutoJsonRpcServiceImpl


import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

import tk.mybatis.mapper.entity.Example
import java.util.Date
import java.sql.Timestamp

import java.text.SimpleDateFormat


import java.util.*


/**
 * xiaying
 */
@AutoJsonRpcServiceImpl
@Service
class CurrentRowServiceImpl : CurrentRowService {


    @Autowired
    protected lateinit var currentRowMapper: CurrentRowMapper


    override fun updateRowIndex(rowNumber: Int) {
        var list= currentRowMapper.selectAll()
        var currentRow=CurrentRow()
        if(list.size>0){
            currentRow=list.get(0)
            currentRow.rowNumber=rowNumber
            currentRowMapper.updateByPrimaryKey(currentRow)
        }
         else if(list.size==0){
            currentRow.rowNumber=rowNumber
            currentRowMapper.insert(currentRow)
        }
    }



    override fun getRowNum(): Int {
             var num=0;
        var list= currentRowMapper.selectAll()
        var currentRow=CurrentRow()
        if(list.size>0){
             currentRow=list.get(0)
            num=currentRow.rowNumber.toInt()
        }
        return num
    }

    override fun getLastGXSJ(): String {

        return ""
    }




}